package zx.x.modules.app.controller;

import java.util.Arrays;
import java.util.List;
import java.util.Map;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.github.pagehelper.Page;
import com.github.pagehelper.PageHelper;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import zx.x.modules.app.entity.DybEntity;
import zx.x.modules.app.entity.JqjsEntity;
import zx.x.modules.app.service.DybService;
import zx.x.common.utils.PageUtils;
import zx.x.common.utils.R;



/**
 * 导游商品表
 *
 * @author x
 * @email x
 * @date 2023-09-16 15:24:04
 */
@RestController
@RequestMapping("app/dyb")
public class DybController {
    @Autowired
    private DybService dybService;

    /**
     * 列表
     */
    @RequestMapping("/list")
    public R list(DybEntity dy){
        QueryWrapper<DybEntity> queryWrapper = new QueryWrapper<DybEntity>();
        queryWrapper.eq("delete_flag","0").eq("sfsj","1");
        Page page = PageHelper.startPage(dy.getPage(),dy.getLimit());
        List<DybEntity> list = dybService.list(queryWrapper);
        return R.ok().put("page", list).put("pages",page.getPages()).put("total",page.getTotal());
    }


    /**
     * 信息
     */
    @RequestMapping("/info")
    public R info(Integer id){
		DybEntity dyb = dybService.getById(id);
        return R.ok().put("dyb", dyb);
    }

    /**
     * 保存
     */
    @RequestMapping("/save")
    public R save(@RequestBody DybEntity dyb){
		dybService.save(dyb);

        return R.ok();
    }

    /**
     * 修改
     */
    @RequestMapping("/update")
    public R update(@RequestBody DybEntity dyb){
		dybService.updateById(dyb);

        return R.ok();
    }

    /**
     * 删除
     */
    @RequestMapping("/delete")
    public R delete(@RequestBody Integer[] ids){
		dybService.removeByIds(Arrays.asList(ids));

        return R.ok();
    }

}
